﻿using System.Collections;
using System.Linq.Expressions;

namespace Xmart.Expressions.DynamicPredicate;

public class TestDynamicPredicateExtensions : IDynamicPredicateExtensions
{
    public async Task<IList> GetBelongToListAsync(Type type, string property, string value, CancellationToken cancellationToken = default)
    {
        await Task.CompletedTask;
        return new List<byte> { 1, 2, 3 };
    }

    public async Task<Expression?> GetCustomPredicateAsync(DynamicPredicateItem item, Type propertyReflectedType, Type propertyType, Expression memberExpression, CancellationToken cancellationToken = default)
    {
        await Task.CompletedTask;
        var val = Expression.Constant(int.Parse(item.Value));
        return Expression.Equal(memberExpression, val);
    }

    public async Task<object?> ParseToValueTypeAsync(Type type, string value, CancellationToken cancellationToken = default)
    {
        await Task.CompletedTask;
        return default;
    }
}